introduce a new method to show tooltip with coordinates #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @chirag04
I'm facing a very tricky problem when I'm using tooltip with redux. I have to call
show
method duringcomponentDidUpdate
stage, but by the time, container view of tooltip would still be in the wrong position. So I add a method to put the container to right place before it gets rendered.More specifically, I form my view like this
So the flow is,
-> someone clicks
WebView
, it tells component where to show the tooltip-> reducer changes coordinates in states, also map to props
->
componentDidUpdate
state: WebView gets new coordinates, callshowMenu
-> re-render, apply the new coordinates to the
View
What's tricky is when it's in the stage of
componentDidUpdate
,View
has not re-rended yet, so the tooltip shows from old coordinates. Also there's no callback to allow me to do anything (like callingshowMenu
) after view got re-rendered.So I expose a new method here to show the tooltip with coordinate, called
showFromRect
, and I change the container to where it should be. Of course when app runs into render stage it will update the coordinate of the container again, but as long as we passed same coordinates before that, it will remain same position.Might be too specific, hope someone else would want this too :)